home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3dm / old-compression / clOpenMux.z / clOpenMux
Encoding:
Text File  |  1998-10-20  |  8.2 KB  |  199 lines

  1.  
  2.  
  3.  
  4. ccccllll MMMMuuuullllttttiiiipppplllleeeexxxxiiiinnnngggg((((3333ddddmmmm))))                                      ccccllll MMMMuuuullllttttiiiipppplllleeeexxxxiiiinnnngggg((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      clOpenMux, clMux, clCloseMux - Multiplex video and audio streams
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////ccccllll....hhhh>>>>
  13.  
  14.      iiiinnnntttt ccccllllOOOOppppeeeennnnMMMMuuuuxxxx((((iiiinnnntttt sssscccchhhheeeemmmmeeee,,,, CCCCLLLLhhhhaaaannnnddddlllleeee ****hhhhaaaannnnddddlllleeeePPPPttttrrrr))))
  15.      iiiinnnntttt ccccllllMMMMuuuuxxxx((((CCCCLLLLhhhhaaaannnnddddlllleeee hhhhaaaannnnddddlllleeee,,,, iiiinnnntttt ccccoooouuuunnnntttt))))
  16.      iiiinnnntttt ccccllllCCCClllloooosssseeeeMMMMuuuuxxxx((((CCCCLLLLhhhhaaaannnnddddlllleeee hhhhaaaannnnddddlllleeee))))
  17.  
  18. AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  19.      _s_c_h_e_m_e         The multiplexing scheme to use.
  20.  
  21.      _h_a_n_d_l_e_P_t_r      A pointer to the returned handle of the multiplexer.  Used
  22.                     by subsequent calls to identify the multiplexer.
  23.  
  24.      _h_a_n_d_l_e         A handle to the multiplexer.
  25.  
  26.      _c_o_u_n_t          The number of iterations to execute.  The amount of
  27.                     processing done during each iteration is scheme and data
  28.                     dependent.  _c_o_u_n_t may also be specified as
  29.                     CCCCLLLL____CCCCOOOONNNNTTTTIIIINNNNUUUUOOOOUUUUSSSS____BBBBLLLLOOOOCCCCKKKK or CCCCLLLL____CCCCOOOONNNNTTTTIIIINNNNUUUUOOOOUUUUSSSS____NNNNOOOONNNNBBBBLLLLOOOOCCCCKKKK.
  30.  
  31.  
  32. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  33.      ccccllllOOOOppppeeeennnnMMMMuuuuxxxx opens a multiplexer for a given scheme.  It is called before
  34.      ccccllllMMMMuuuuxxxx or any call that requires a multiplexer handle.  ccccllllCCCClllloooosssseeeeMMMMuuuuxxxx closes
  35.      the multiplexer after which _h_a_n_d_l_e is no longer valid.
  36.  
  37.      ccccllllMMMMuuuuxxxx takes no buffer arguments so it always invokes the Implicit
  38.      Buffering model (see CLintro(3dm)).  Input buffers of type CL_BUF_VIDEO
  39.      and CL_BUF_AUDIO, and an output buffer of type CL_BUF_MUX, must have been
  40.      created previously with ccccllllCCCCrrrreeeeaaaatttteeeeBBBBuuuuffff.  The input buffers are filled with
  41.      calls to ccccllllQQQQuuuueeeerrrryyyyFFFFrrrreeeeeeee, ccccllllUUUUppppddddaaaatttteeeeHHHHeeeeaaaadddd, and ccccllllDDDDoooonnnneeeeUUUUppppddddaaaattttiiiinnnnggggHHHHeeeeaaaadddd.  The output
  42.      buffer is emptied with calls to ccccllllQQQQuuuueeeerrrryyyyVVVVaaaalllliiiidddd and ccccllllUUUUppppddddaaaatttteeeeTTTTaaaaiiiillll.
  43.  
  44.      Buffers should be appropriately sized for proper execution of ccccllllMMMMuuuuxxxx.  The
  45.      input buffers should have minimum capacities of CL_VIDEO_BUFFER_SIZE and
  46.      CL_AUDIO_BUFFER_SIZE.  The output buffer should have a minimum capacity
  47.      of CL_MUX_BUFFER_SIZE.  These parameters may be determined by calling
  48.      ccccllllGGGGeeeettttPPPPaaaarrrraaaammmmssss, after first calling ccccllllSSSSeeeettttPPPPaaaarrrraaaammmmssss to provide the multiplexer
  49.      with any initialization information it may need (e.g. pack size,
  50.      bitrate).
  51.  
  52.      If _c_o_u_n_t is non-negative, ccccllllMMMMuuuuxxxx attempts to perform _c_o_u_n_t iterations of
  53.      the multiplexing operation.  The actual amount of data processed in each
  54.      iteration is scheme and data dependent.  The call to ccccllllMMMMuuuuxxxx may consume up
  55.      to CL_VIDEO_BUFFER_SIZE * _c_o_u_n_t bytes of video data, and up to
  56.      CL_AUDIO_BUFFER_SIZE * _c_o_u_n_t bytes of audio data.  This may produce up to
  57.      CL_MUX_BUFFER_SIZE * _c_o_u_n_t bytes of multiplexed data.  The call does not
  58.      return until processing is completed.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ccccllll MMMMuuuullllttttiiiipppplllleeeexxxxiiiinnnngggg((((3333ddddmmmm))))                                      ccccllll MMMMuuuullllttttiiiipppplllleeeexxxxiiiinnnngggg((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74.      If _c_o_u_n_t is specified as CL_CONTINUOUS_BLOCK or CL_CONTINUOUS_NONBLOCK
  75.      then ccccllllMMMMuuuuxxxx continues until either the input buffers are marked done, or a
  76.      call to ccccllllCCCClllloooosssseeeeMMMMuuuuxxxx is made.  CL_CONTINUOUS_NONBLOCK differs from
  77.      CL_CONTINUOUS_BLOCK in that the call to ccccllllMMMMuuuuxxxx returns immediately while
  78.      the multiplexing occurs in a separate thread.
  79.  
  80.      Several multiplexers can be open simultaneously.  _h_a_n_d_l_e identifies which
  81.      one is being referenced.
  82.  
  83.  
  84. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEESSSS
  85.      Each routine returns a negative error code if the call fails.  Upon
  86.      success, ccccllllOOOOppppeeeennnnMMMMuuuuxxxx and ccccllllCCCClllloooosssseeeeMMMMuuuuxxxx return SUCCESS, and ccccllllMMMMuuuuxxxx returns
  87.      either the count actually processed or, in the case of
  88.      CL_CONTINUOUS_NONBLOCK, returns SUCCESS immediately.
  89.  
  90.  
  91. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  92.           #include <dmedia/cl.h>
  93.  
  94.           int paramValueBuffer[][2] = {
  95.               CL_VIDEO_BUFFER_SIZE, 0,
  96.               CL_AUDIO_BUFFER_SIZE, 0,
  97.               CL_MUX_BUFFER_SIZE, 0,
  98.           };
  99.  
  100.           /* Open the multiplexer */
  101.           clOpenMux(CL_MPEG1_SYSTEMS_SOFTWARE, &handle);
  102.  
  103.           /* Configure the multiplexer by setting some params */
  104.           clSetParam(handle, CL_BITRATE, 1500000);
  105.  
  106.           /* Allocate buffers of the required size */
  107.           clGetParams(handle, (int *)paramValueBuffer, 6);
  108.           clCreateBuf(handle, CL_BUF_VIDEO, paramValueBuffer[0][1], 1, NULL);
  109.           clCreateBuf(handle, CL_BUF_AUDIO, paramValueBuffer[1][1], 1, NULL);
  110.           clCreateBuf(handle, CL_BUF_MUX, paramValueBuffer[2][1], 1, NULL);
  111.  
  112.           /* Multiplex a few iterations */
  113.           for(i = 0; i < N; i++)
  114.           {
  115.               /* Keep the input buffers full */
  116.               ...
  117.               clMux(handle, 1);
  118.               /* Write the multiplexed data to somewhere */
  119.               ...
  120.           }
  121.  
  122.           /* Close the multiplexer */
  123.           clCloseMux(handle);
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ccccllll MMMMuuuullllttttiiiipppplllleeeexxxxiiiinnnngggg((((3333ddddmmmm))))                                      ccccllll MMMMuuuullllttttiiiipppplllleeeexxxxiiiinnnngggg((((3333ddddmmmm))))
  137.  
  138.  
  139.  
  140. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  141.      CLintro(3dm), clSetParams(3dm), clGetParams(3dm), clCreateBuf(3dm),
  142.      clQueryFree(3dm), clUpdateHead(3dm), clQueryValid(3dm),
  143.      clUpdateTail(3dm), clDoneUpdatingHead(3dm)
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.